<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "/include/head_common.html">
<title>区域<#if area.id??&&area.id!=''>修改<#else>添加</#if></title>
<meta name="decorator" content="default" />
	<script type="text/javascript">
        $(document).ready(function () {
            $("#name").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
        function goback(){
        	$.cookie('goback','goback',{path: '/',expires: 1});
        	history.go(-1);
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="list">区域列表</a></li>
    <li class="active"><a href="edit?id=${area.id!''}">区域<#if area.id??&&area.id!=''>修改<#else>添加</#if></a></li>
</ul>
<br/>
<form id="inputForm" action="edit" method="post" class="form-horizontal">
    <input type="hidden" name="id" value="${area.id!''}"/>
    <input type="hidden" name="sort" value="${area.sort!'10'}"/>
    <div class="control-group">
        <label class="control-label">上级区域:</label>
        <div class="controls">
			<@wolfking.treeView id="area" name="parentId" 
						value="${area.parentId!''}" 
						labelName="${parent.name!''}"
                        labelValue="${parent.name!''}"
                        title="区域" 
                        url="/area/treeData"
                        allowClear="true">
				<#include "/tool/treeTag.html">
			</@wolfking.treeView>
        </div>
    </div>
   
    <div class="control-group">
        <label class="control-label">区域名称:</label>
        <div class="controls">
            <input id="name" type="text" name="name" value="${area.name!''}" maxlength="50" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">区域编码:</label>
        <div class="controls">
            <input type="text" name="code" value="${area.code!''}" maxlength="50"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">区域类型:</label>
        <div class="controls">
           <select name="type" style="width:220px">
           		<#list types as dict>
           			<option value="${dict.value}" <#if area.type??&&dict.value==area.type> selected </#if>>${dict.label!''}</option>
           		</#list>
           </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">备注:</label>
        <div class="controls">
        	<textarea name="remarks">${area.remarks!''}</textarea>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;&nbsp;&nbsp;&nbsp;
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="goback()"/>
    </div>
</form>
</body>
</html>